package main

import "fmt"

type User1 struct {
	name string
	age  int
	sex  string
}

func main() {
	//结构体是值类型，值传递
	user1 := User1{"qinjiang", 18, "nan"}
	fmt.Println(user1)
	user2 := user1
	user2.name = "kuangshen"
	fmt.Println(user1)
	fmt.Println(user2)

	//指针
	var user3 *User1
	user3 = &user1
	(*user3).name = "feige"
	fmt.Println(user1)

	//new 方法 跟指针的效果一样
	user4 := new(User1)
	user4.name = "xuexiangban"
	fmt.Printf("%T\n", user4) // 以指针的形式
	fmt.Println(user1)

}
